package ui.mainwidget;

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;

import ui.MainWindow;
import ui.resource.ResourceManager;
import ui.resource.ResourceURL;

public class AppInfo extends org.eclipse.swt.widgets.Composite {
	{
		ResourceManager.registerResourceUser(this);
	}

	private Button 						   	     confirmButton;
	public AppInfo(org.eclipse.swt.widgets.Composite parent, int style) {
		super(parent, style);
        this.addPaintListener(new PaintListener() {  
            public void paintControl(PaintEvent e) {  
                Point size  	=  AppInfo.this.getSize();  
                Point location  =  AppInfo.this.getLocation(); 
                Image image=ResourceManager.getImage(ResourceURL.getBackgroundImageURL());
                ImageData imageData=image.getImageData();
                e.gc.drawImage(image, 0, 0, imageData.width, imageData.height, location.x, location.y, size.x, size.y);  
            }
        });
		initGUI();
	}
	private void 								initGUI() {
		try {
			FormLayout thisLayout = new FormLayout();
			this.setLayout(thisLayout);
			this.setSize(MainWindow.getStandardWidth(), MainWindow.getStandardHeight());
			{
				confirmButton 				= 	new Button(this, SWT.PUSH | SWT.CENTER);
				FormData confirmButtonLData = 	new FormData();
				confirmButtonLData.left 	=  	new FormAttachment(0, 1000, 180);
				confirmButtonLData.top 		=  	new FormAttachment(0, 1000, 246);
				confirmButtonLData.width  	= 	62;
				confirmButtonLData.height 	= 	19;
				confirmButton.setLayoutData(confirmButtonLData);
				confirmButton.setText("\u786e\u5b9a");
			}
			this.layout();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
